﻿@model List<SarahShop.Models.Product>

@{
    ViewBag.Title = "Products";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
<!-- start main -->
<div class="main_bg">
    <div class="wrap">
        <div class="main">

            <div class="top_main">
                <h2>Sản phẩm</h2>
                <div class="clear"></div>
            </div>
            <!-- start grids_of_3 -->
            @{
                int times = Model.Count() / 3 + 1;
                int count = 0;
                for (int i = 0; i < times; i++)
                {
                <div class="grids_of_3">
                    @for (int j = 0; j < 3; j++)
                    {

                        if (count < Model.Count())
                        {
                            string text = Model[count].Status == 1 ? "New" : Model[count].Status == 2 ? "Sale" : "";
                            string cls = text == "Sale" ? "price1 bg" : text == "New" ? "price1 bg1" : "";
                        
                        <div class="grid1_of_3">
                            <a href="/Home/Details?pcode=@Model[count].Code">
                                <img src="~/Content/images/source/@Model[count].Image" alt="" />
                                <h3>@Model[count].Name</h3>
                                <span class="price">$@Model[count].Price.ToString("N0")</span>
                                <span class="@cls">@text</span>
                            </a>
                        </div>
                            count++;
                        }

                    }
                    <div class="clear"></div>
                </div>
                <div class="clear"></div>
                }
                
            }
            <div class="clear"></div>
        </div>
    </div>
</div>
